<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>联系我们</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css">
		<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.3/css/jquery-weui.min.css">
		<link rel="stylesheet" href="../css/index.css" />
	</head>

	<body id="contactus">
		<div id="contactuslist">
		<!--<div class="weui_cells">
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>万象物业管理处</p>
		    </div>
		    
		  </div>
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>电话</p>
		    </div>
		    <div class="weui_cell_ft">
		    	15755055889
		    </div>
		  </div>
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>地址</p>
		    </div>
		    <div class="weui_cell_ft">
		    	西城时代商务中心
		    </div>
		  </div>
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>联系人</p>
		    </div>
		    <div class="weui_cell_ft">
		    	李小军
		    </div>
		  </div>
		</div>
		<div class="weui_cells">
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>万象物业管理处</p>
		    </div>
		  </div>
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>电话</p>
		    </div>
		    <div class="weui_cell_ft">
		    	15755055889
		    </div>
		  </div>
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>地址</p>
		    </div>
		    <div class="weui_cell_ft">
		    	西城时代商务中心
		    </div>
		  </div>
		  <div class="weui_cell">
		    <div class="weui_cell_bd weui_cell_primary">
		      <p>联系人</p>
		    </div>
		    <div class="weui_cell_ft">
		    	李小军
		    </div>
		  </div>
		</div>-->
		</div>
		<div class="weui-infinite-scroll loading">
			  <div class="infinite-preloader"></div>
			  正在加载中... 
		</div>
		<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
		<script src="//cdn.bootcss.com/jquery-weui/0.8.3/js/jquery-weui.min.js"></script>
		<script type="text/javascript" src="../js/basic.js"></script>
		<script>
			var ip_addr = getUrl();
			var pageNo = 1;
			var pageSize = 4;
			var loading = false;
			$(document).ready(function() {
				departmentlist();
				$("#contactus").infinite().on("infinite", function() {
					 if(loading) return;
					  loading = true;
					  setTimeout(function() {
					    pageNo++; 
					    departmentlist();
					    loading = false;
					  }, 800); 
				});
			});
			//联系我们列表接口
			function departmentlist() {
				$.ajax({
					type: 'post',
					dataType: "json",
					url: ip_addr + 'department/list',
					data: {
						pageNo: pageNo,
						pageSize:pageSize
					},
					success: function(data) {
						var result = data.rows;
						var innerHTML = '';
						if(data.total < pageNo*pageSize){
							loading = true;
							$(".loading").hide();
						}else{
							loading = false;
						}
						if(data.total < 3){
							$(".loading").hide();
						}
						if(data.code == 0) {
							for(var i = 0; i < result.length; i++) {
								innerHTML += '<div class="weui_cells">';
								innerHTML += '<div class="weui_cell">';
								innerHTML += '<div class="weui_cell_bd weui_cell_primary">';
								innerHTML += '<p>'+result[i].name+'</p>';
								innerHTML += '</div>';
								innerHTML += '</div>';
								innerHTML += '<div class="weui_cell">';
								innerHTML += '<div class="weui_cell_bd weui_cell_primary">';
								innerHTML += '<p>电话</p>';
								innerHTML += '</div>';
								innerHTML += '<div class="weui_cell_ft">'+result[i].phone+'</div>';
								innerHTML += '</div>';
								innerHTML += ' <div class="weui_cell">';
								innerHTML += '<div class="weui_cell_bd weui_cell_primary">';
								innerHTML += '<p>地址</p>';
								innerHTML += '</div>';
								innerHTML += '<div class="weui_cell_ft">'+result[i].address+'</div>';
								innerHTML += '</div>';
								innerHTML += '<div class="weui_cell">';
								innerHTML += '<div class="weui_cell_bd weui_cell_primary">';
								innerHTML += '<p>联系人</p>';
								innerHTML += '</div>';
								innerHTML += '<div class="weui_cell_ft">'+result[i].contact+'</div>';
								innerHTML += '</div>';
								innerHTML += '</div>';
							}
							$("#contactuslist").append(innerHTML)
						} else {
							alert(data.msg);
						}
					}
				});
			}
		</script>
	</body>

</html>